package com.example.wan_android.adapter

import android.widget.ImageView
import com.bumptech.glide.Glide
import com.example.wan_android.BR
import com.example.wan_android.R
import com.example.wan_android.core.CoreViewHolder
import com.example.wan_android.databinding.AdapterDrawItemBinding
import com.example.wan_android.model.DrawItemData
import com.example.wan_android.viewmodel.MainViewModel

class DrawItemAdapter(vm: MainViewModel) :
    CoreAdapter<AdapterDrawItemBinding, MainViewModel, DrawItemData>(
        BR.data,
        BR.viewModel,
        vm
    ) {
    override fun getItemLayoutId(viewType: Int): Int {
        return R.layout.adapter_draw_item
    }

    override fun onBindViewHolder(holder: CoreViewHolder, position: Int) {
        super.onBindViewHolder(holder, position)
        Glide.with(holder.binding.root.context)
            .load(mListData[position].drawItemIcon)
            .into(holder.binding.root.findViewById<ImageView>(R.id.iv_draw_item))

    }
}